package com.neusoft.demo3;

public class Test4 {
    public static int[] popSort(int[] a) {
        //int[] a = {4,1,6,2,3,8,7};
        int temp = 0;
        for(int i = 1; i < a.length; i++) {
            for(int j = 0; j < a.length-i; j++) {
                if(a[j] > a[j+1]) {
                    temp = a[j];
                    a[j] = a[j+1];
                    a[j+1] = temp;
                }
            }
        }
        return a;
    }
    public static void main(String[] args) {
        int[] a = {4,1,6,2,3,8,7};
        int[] arr = Test4.popSort(a);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }


    }
}
